<div class="page-toolbar">
    <div class="page-filter fr">
        <form class="layui-form layui-form-pane" action="{:url()}" method="get">
        <div class="layui-form-item">
            <label class="layui-form-label">搜索</label>
            <div class="layui-input-inline">
                <input type="text" name="q" value="{:input('get.q')}" lay-verify="required" placeholder="名称" autocomplete="off" class="layui-input">
            </div>
        </div>
        </form>
    </div>
    <div class="layui-btn-group fl">
        <a href="{:url('add')}" class="layui-btn layui-btn-primary"><i class="aicon ai-tianjia"></i>添加</a>
    </div>
</div>
<form id="pageListForm">
<div class="layui-form">
    <table class="layui-table mt10" lay-even="" lay-skin="row">
        
        <thead>
            <tr>
                <th>名称</th>
                <th>是否启用</th>
                <th>操作</th>
            </tr> 
        </thead>
        <tbody>
           
            {volist name="data_list" id="vo"}
            <tr>
                <td class="font18">
                    <p class="ml10 fl"><strong class="mcolor">{$vo['name']}</strong></p>
                </td>
                <td class="font18">{:list_yn_2($vo['is_del'])}</td>
				<td>
			
                    <div class="layui-btn-group">
						<a href="{:url('edit?id='.$vo['id'])}" class="layui-btn layui-btn-primary layui-btn-small"><i class="layui-icon">&#xe642;</i></a>
					 
						<a data-href="{:url('edit?ql=kq&id='.$vo['id'])}" class="layui-btn layui-btn-primary layui-btn-small j-tr-kk">开启</a>
						
						 <a data-href="{:url('edit?ql=gb&id='.$vo['id'])}" class="layui-btn layui-btn-primary layui-btn-small j-tr-gg">关闭</a>
                 
					</div>

                </td>
            </tr>
            {/volist}
        </tbody>
    </table>
    {$pages}
</div>
</form>
<script>
 
layui.use(['jquery' ], function() {
   var $ = layui.jquery;
   $('.j-tr-gg').click(function() {
        var that = $(this);
        layer.confirm('您确定关闭吗？', {title:false, closeBtn:0}, function(index){
            layer.msg('数据提交中...',{time:500000});
				var href = that.attr('href') ? that.attr('href') : that.attr('data-href');
                $.get(href, {}, function(res) {
					layer.msg(res.msg, {},function() {
						if (res.code == 1) {
							location.reload();
							
						}
					});
                    
                });
        });
        return false;
    });
	
	$('.j-tr-kk').click(function() {
        var that = $(this);
        layer.confirm('您确定开启吗？', {title:false, closeBtn:0}, function(index){
            layer.msg('数据提交中...',{time:500000});
				var href = that.attr('href') ? that.attr('href') : that.attr('data-href');
                $.get(href, {}, function(res) {
					layer.msg(res.msg, {},function() {
						if (res.code == 1) {
							location.reload();
							
						}
					});
                    
                });
        });
        return false;
    });
	
	
});



</script>


	